import * as THREE from "three";

const geometry = new THREE.BoxGeometry(200, 200, 200);
const material = new THREE.MeshLambertMaterial({ color: 0x00ff00 });
const mesh = new THREE.Mesh(geometry, material);

mesh.name = "Box";
const times = [0, 2, 5];
const values = [0, 0, 0, 0, 100, 0, 0, 0, -100];
const keyframeTrack = new THREE.KeyframeTrack("Box.position", times, values);

const times1 = [0, 1, 4];
const values1 = [1, 1, 1, 1, 2, 1, 2, 1, 2];
const keyframeTrack1 = new THREE.KeyframeTrack("Box.scale", times1, values1);

const clip = new THREE.AnimationClip("BoxAnimation", 5, [
	keyframeTrack,
	keyframeTrack1,
]);
const mixer = new THREE.AnimationMixer(mesh);
const clipAction = mixer.clipAction(clip);
clipAction.play();
// clipAction.timeScale = 2; // 播放速度

export { mesh, mixer };
